﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sinacor.Infra.UI.Authorization.Policy.Translator.Enum
{
    public class PolicyTypeTranslator
    {
        public static void Translate(Entity.Enum.PolicyType? from, out Infra.Authorization.Policy.PolicyType? to)
        {
            if (from == null)
                to = null;
            else
            {
                switch (from)
                {
                    case Entity.Enum.PolicyType.Permissive:
                        to = Infra.Authorization.Policy.PolicyType.Permissive;
                        break;
                    case Entity.Enum.PolicyType.Restrictive:
                        to = Infra.Authorization.Policy.PolicyType.Restrictive;
                        break;
                    default:
                        to = null;
                        break;
                }
            }
        }

        public static void Translate(Infra.Authorization.Policy.PolicyType? from, out Entity.Enum.PolicyType? to)
        {
            if (from == null)
                to = null;
            else
            {
                switch (from)
                {
                    case Infra.Authorization.Policy.PolicyType.Permissive:
                        to = Entity.Enum.PolicyType.Permissive;
                        break;
                    case Infra.Authorization.Policy.PolicyType.Restrictive:
                        to = Entity.Enum.PolicyType.Restrictive;
                        break;
                    default:
                        to = null;
                        break;
                }
            }
        }
    }
}
